]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
legacyTray: Try to set an accessible name for status icons
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 19 Mar 2015 21:54:21 +0000 (22:54 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Sun, 22 Mar 2015 08:33:33 +0000 (09:33 +0100)
While legacy status icons lack a proper accessible name of their own,
we can try to find the corresponding application or the icon's window
title - hopefully most status icons provide at least one, so they
don't show up completely "blank" in screen readers.

https://bugzilla.gnome.org/show_bug.cgi?id=746487

js/ui/legacyTray.js

index 6e8953bf8571360d81764ecb62b2e9787d5a2fdd..57a756a4bf7eb5d40bec960c211ff1e048926679 100644 (file)
@@ -147,6 +147,17 @@ const LegacyTray = new Lang.Class({
                                                   St.ButtonMask.THREE,
                                      can_focus: true,
                                      x_fill: true, y_fill: true });
+
+        let app = Shell.WindowTracker.get_default().get_app_from_pid(icon.pid);
+        if (!app)
+            app = Shell.AppSystem.get_default().lookup_startup_wmclass(wmClass);
+        if (!app)
+            app = Shell.AppSystem.get_default().lookup_desktop_wmclass(wmClass);
+        if (app)
+            button.accessible_name = app.get_name();
+        else
+            button.accessible_name = icon.title;
+
         button.connect('clicked',
             function() {
                 icon.click(Clutter.get_current_event());